<template>
  <div class="HomeHear-box">
    <div class="wrap">
      <div class="title">
        <p class="name">听说</p>
        <p class="decorate">
          ——— <span class="iconfont search-icon">&#xe667;</span> ———
        </p>
        <p class="desc">LISTENING</p>
      </div>
      <div class="HomeHear-body">
        <div v-for="(item, index) in HomeListenArr" :key="index">
          <a href="##">
            <img :src="item.img" alt="" />
          </a>
          <div class="HomeHear-text">
            <a href="##">
              <h4 class="HomeHear-author">{{ item.writer }}</h4>
            </a>
            <a href="##">
              <h3 class="HomeHear-name">{{ item.title }}</h3>
            </a>
            <p class="HomeHear-desc">{{ item.content }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      HomeListenArr: [],
    };
  },
  mounted() {
    this.$api.HomeListening().then((res) => {
      if (res.status === 200) {
        var arr = res.data.listening;
        for (var i = 0; i < arr.length; i++) {
          arr[i].img =
            "http://iwenwiki.com/api/" + String(arr[i].img).slice(24);
        }
        this.HomeListenArr = arr;
      }
    });
  },
};
</script>

<style lang="less" scoped>
.wrap {
  width: 1200px;
  margin: 0 auto;
}
.HomeHear-box {
  background-color: #f5f5f5;
  overflow: hidden;
  text-align: left;
}
.title {
  width: 140px;
  height: 73px;
  margin: 39px auto 0;
  text-align: center;
  .name {
    color: #292929;
    margin-bottom: 5px;
    font-size: 24px;
  }
  .decorate {
    opacity: 0.1;
  }
  .desc {
    color: #292929;
    margin-bottom: 5px;
  }
}
.HomeHear-body {
  margin: 50px 0 20px;
  img {
    width: 240px;
    height: 250px;
    float: left;
  }
}
.HomeHear-text {
  width: 192px;
  margin-left: 8px;
  padding: 20px;
  float: left;
}
.HomeHear-author {
  color: #52ca91;
  font-size: 12px;
  margin-bottom: 10px;
}
.HomeHear-name {
  color: #000;
  font-size: 16px;
  margin-bottom: 15px;
}
.HomeHear-desc {
  color: #666;
}
</style>